/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jsysacc.asistencia.view.gui.maestros;

import com.cerd.util.BaseSP01.JUtilBaseSP01;
import com.jsysacc.asistencia.model.beans.maestros.Horario;
import com.jsysacc.asistencia.model.logic.maestros.HorarioLogic;
import com.jsysacc.asistencia.view.resources.commons.JLogicInterfaz;
import com.jsysacc.asistencia.view.resources.commons.JTextFieldToUpperCase;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;

/**
 *
 * @author Carlos
 */
public class FormDialogMantHorario extends javax.swing.JDialog implements JLogicInterfaz {

    HorarioLogic logic = new HorarioLogic();
    private boolean esNuevo;
    private String codHorario;

    //variable locales
    private Horario entityHorario;

    private final ResourceBundle rbMensajes = ResourceBundle.getBundle("com.jsysacc.asistencia.view.resources.commons.Mensajes");
    private final JUtilBaseSP01 JUB = JUtilBaseSP01.JUtilBaseSP01;

    /**
     * Creates new form FormDialogMantHorario
     */
    public FormDialogMantHorario(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    private void limpiar() {
        this.jtxtCodigo.setText("");
        this.jtxtDescripcion.setText("");
        //LV
        this.jchkHorarioCorridoLV.setSelected(false);
        //Maniana
        this.jsfHoraInicioManianaHHLV.setValue(0);
        this.jsfHoraInicioManianaMMLV.setValue(0);
        this.jsfHoraFinManianaHHLV.setValue(0);
        this.jsfHoraFinManianaMMLV.setValue(0);
        //Tarde
        this.jsfHoraInicioTardeHHLV.setValue(0);
        this.jsfHoraInicioTardeMMLV.setValue(0);
        this.jsfHoraFinTardeHHLV.setValue(0);
        this.jsfHoraFinTardeMMLV.setValue(0);

        //SAB
        this.jchkHorarioCorridoSab.setSelected(false);
        //Maniana
        this.jsfHoraInicioManianaHHSab.setValue(0);
        this.jsfHoraInicioManianaMMSab.setValue(0);
        this.jsfHoraFinManianaHHSab.setValue(0);
        this.jsfHoraFinManianaMMSab.setValue(0);
        //Tarde
        this.jsfHoraInicioTardeHHSab.setValue(0);
        this.jsfHoraInicioTardeMMSab.setValue(0);
        this.jsfHoraFinTardeHHSab.setValue(0);
        this.jsfHoraFinTardeMMSab.setValue(0);
    }

    private void checkHorarioCorridoLV(boolean valor) {
        this.jsfHoraInicioTardeHHLV.setValue(0);
        this.jsfHoraInicioTardeMMLV.setValue(0);
        this.jsfHoraFinTardeHHLV.setValue(0);
        this.jsfHoraFinTardeMMLV.setValue(0);

        this.jlblTardeLV.setEnabled(!valor);
        this.jsfHoraInicioTardeHHLV.setEnabled(!valor);
        this.jsfHoraInicioTardeMMLV.setEnabled(!valor);
        this.jsfHoraFinTardeHHLV.setEnabled(!valor);
        this.jsfHoraFinTardeMMLV.setEnabled(!valor);
        //Label
        this.jlbl11.setEnabled(!valor);
        this.jlbl12.setEnabled(!valor);
        this.jlbl13.setEnabled(!valor);
        this.jlbl14.setEnabled(!valor);
        this.jlbl15.setEnabled(!valor);
        this.jlbl16.setEnabled(!valor);

    }

    private void checkHorarioCorridoSab(boolean valor) {
        this.jsfHoraInicioTardeHHSab.setValue(0);
        this.jsfHoraInicioTardeMMSab.setValue(0);
        this.jsfHoraFinTardeHHSab.setValue(0);
        this.jsfHoraFinTardeMMSab.setValue(0);

        this.jlblTardeSab.setEnabled(!valor);
        this.jsfHoraInicioTardeHHSab.setEnabled(!valor);
        this.jsfHoraInicioTardeMMSab.setEnabled(!valor);
        this.jsfHoraFinTardeHHSab.setEnabled(!valor);
        this.jsfHoraFinTardeMMSab.setEnabled(!valor);
        //Label
        this.jlbl27.setEnabled(!valor);
        this.jlbl28.setEnabled(!valor);
        this.jlbl29.setEnabled(!valor);
        this.jlbl30.setEnabled(!valor);
        this.jlbl31.setEnabled(!valor);
        this.jlbl32.setEnabled(!valor);
    }

    //metodo para saber si viene del modificar o del nuevo
    private void llenarData() {

        if (esNuevo) {
            limpiar();
        } else {
            try {
                Horario oHorario = logic.getByPk(codHorario);
                if (JUB._vacio(oHorario)) {
                    JOptionPane.showMessageDialog(this, " REGISTRO CON CÓDIGO: " + codHorario + " NO EXISTE EN LA BD.", rbMensajes.getString("MSG_MEN_PRI"), 0);
                } else {
                    setEntity(oHorario);
                    this.jtxtDescripcion.requestFocus();
                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, ex.getMessage(), rbMensajes.getString("MSG_MEN_PRI"), 0);
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jbtnCancelar = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtxtCodigo = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jtxtDescripcion = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jchkEstado = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jlbl03 = new javax.swing.JLabel();
        jsfHoraInicioManianaHHLV = new com.toedter.components.JSpinField();
        jlbl04 = new javax.swing.JLabel();
        jsfHoraInicioManianaMMLV = new com.toedter.components.JSpinField();
        jlbl05 = new javax.swing.JLabel();
        jlbl06 = new javax.swing.JLabel();
        jsfHoraFinManianaHHLV = new com.toedter.components.JSpinField();
        jlbl07 = new javax.swing.JLabel();
        jsfHoraFinManianaMMLV = new com.toedter.components.JSpinField();
        jlbl08 = new javax.swing.JLabel();
        jlbl16 = new javax.swing.JLabel();
        jsfHoraInicioTardeMMLV = new com.toedter.components.JSpinField();
        jlbl13 = new javax.swing.JLabel();
        jsfHoraFinTardeHHLV = new com.toedter.components.JSpinField();
        jlbl12 = new javax.swing.JLabel();
        jsfHoraFinTardeMMLV = new com.toedter.components.JSpinField();
        jsfHoraInicioTardeHHLV = new com.toedter.components.JSpinField();
        jlbl11 = new javax.swing.JLabel();
        jlbl15 = new javax.swing.JLabel();
        jlbl14 = new javax.swing.JLabel();
        jlblManianaLV = new javax.swing.JLabel();
        jlblTardeLV = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jchkHorarioCorridoLV = new javax.swing.JCheckBox();
        jPanel6 = new javax.swing.JPanel();
        jlbl19 = new javax.swing.JLabel();
        jsfHoraInicioManianaHHSab = new com.toedter.components.JSpinField();
        jlbl20 = new javax.swing.JLabel();
        jsfHoraInicioManianaMMSab = new com.toedter.components.JSpinField();
        jlbl21 = new javax.swing.JLabel();
        jlbl22 = new javax.swing.JLabel();
        jsfHoraFinManianaHHSab = new com.toedter.components.JSpinField();
        jlbl23 = new javax.swing.JLabel();
        jsfHoraFinManianaMMSab = new com.toedter.components.JSpinField();
        jlbl24 = new javax.swing.JLabel();
        jlbl32 = new javax.swing.JLabel();
        jsfHoraInicioTardeMMSab = new com.toedter.components.JSpinField();
        jlbl29 = new javax.swing.JLabel();
        jsfHoraFinTardeHHSab = new com.toedter.components.JSpinField();
        jlbl28 = new javax.swing.JLabel();
        jsfHoraFinTardeMMSab = new com.toedter.components.JSpinField();
        jsfHoraInicioTardeHHSab = new com.toedter.components.JSpinField();
        jlbl27 = new javax.swing.JLabel();
        jlbl31 = new javax.swing.JLabel();
        jlbl30 = new javax.swing.JLabel();
        jlblManianaSab = new javax.swing.JLabel();
        jlblTardeSab = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jchkHorarioCorridoSab = new javax.swing.JCheckBox();
        jbtnAceptar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jbtnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jsysacc/asistencia/view/resources/icons/px_24_24/btn_cancelar_24.png"))); // NOI18N
        jbtnCancelar.setText("Cancelar");
        jbtnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCancelarActionPerformed(evt);
            }
        });

        jTabbedPane1.setFocusable(false);

        jLabel1.setText("Código");

        jtxtCodigo.setEditable(false);
        jtxtCodigo.setBackground(java.awt.SystemColor.inactiveCaption);

        jLabel2.setText("Descripción");

        jLabel5.setText("Estado");

        jchkEstado.setText("Activo");

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Horario L - V"));

        jlbl03.setText("Hora Inicio");

        jsfHoraInicioManianaHHLV.setMaximum(23);
        jsfHoraInicioManianaHHLV.setMinimum(0);

        jlbl04.setText("HH");

        jsfHoraInicioManianaMMLV.setMaximum(59);
        jsfHoraInicioManianaMMLV.setMinimum(0);

        jlbl05.setText("MM");

        jlbl06.setText("Hora Fin");

        jsfHoraFinManianaHHLV.setMaximum(23);
        jsfHoraFinManianaHHLV.setMinimum(0);

        jlbl07.setText("HH");

        jsfHoraFinManianaMMLV.setMaximum(59);
        jsfHoraFinManianaMMLV.setMinimum(0);

        jlbl08.setText("MM");

        jlbl16.setText("MM");

        jsfHoraInicioTardeMMLV.setMaximum(59);
        jsfHoraInicioTardeMMLV.setMinimum(0);

        jlbl13.setText("MM");

        jsfHoraFinTardeHHLV.setMaximum(23);
        jsfHoraFinTardeHHLV.setMinimum(0);

        jlbl12.setText("HH");

        jsfHoraFinTardeMMLV.setMaximum(59);
        jsfHoraFinTardeMMLV.setMinimum(0);

        jsfHoraInicioTardeHHLV.setMaximum(23);
        jsfHoraInicioTardeHHLV.setMinimum(0);

        jlbl11.setText("Hora Inicio");

        jlbl15.setText("HH");

        jlbl14.setText("Hora Fin");

        jlblManianaLV.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblManianaLV.setText("MAÑANA");

        jlblTardeLV.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblTardeLV.setText("TARDE");

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setText("Horario Corrido");

        jchkHorarioCorridoLV.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jchkHorarioCorridoLVItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlblManianaLV)
                    .addComponent(jLabel7)
                    .addComponent(jlblTardeLV))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jchkHorarioCorridoLV)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jlbl03)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraInicioManianaHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl04)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraInicioManianaMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl05)
                        .addGap(18, 18, 18)
                        .addComponent(jlbl06)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraFinManianaHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl07)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraFinManianaMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl08))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jlbl11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraInicioTardeHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraInicioTardeMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl13)
                        .addGap(18, 18, 18)
                        .addComponent(jlbl14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraFinTardeHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jsfHoraFinTardeMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl16)))
                .addGap(117, 117, 117))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel7)
                    .addComponent(jchkHorarioCorridoLV))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jlbl03)
                    .addComponent(jsfHoraInicioManianaHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jsfHoraInicioManianaMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl04)
                    .addComponent(jlbl05)
                    .addComponent(jlbl06)
                    .addComponent(jsfHoraFinManianaHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl07)
                    .addComponent(jsfHoraFinManianaMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl08)
                    .addComponent(jlblManianaLV))
                .addGap(14, 14, 14)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jlblTardeLV)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                        .addComponent(jlbl11)
                        .addComponent(jsfHoraInicioTardeHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl12)
                        .addComponent(jsfHoraInicioTardeMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl13)
                        .addComponent(jlbl14)
                        .addComponent(jsfHoraFinTardeHHLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl15)
                        .addComponent(jsfHoraFinTardeMMLV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl16)))
                .addContainerGap(16, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Horario Sábado"));

        jlbl19.setText("Hora Inicio");

        jsfHoraInicioManianaHHSab.setMaximum(23);
        jsfHoraInicioManianaHHSab.setMinimum(0);

        jlbl20.setText("HH");

        jsfHoraInicioManianaMMSab.setMaximum(59);
        jsfHoraInicioManianaMMSab.setMinimum(0);

        jlbl21.setText("MM");

        jlbl22.setText("Hora Fin");

        jsfHoraFinManianaHHSab.setMaximum(23);
        jsfHoraFinManianaHHSab.setMinimum(0);

        jlbl23.setText("HH");

        jsfHoraFinManianaMMSab.setMaximum(59);
        jsfHoraFinManianaMMSab.setMinimum(0);

        jlbl24.setText("MM");

        jlbl32.setText("MM");

        jsfHoraInicioTardeMMSab.setMaximum(59);
        jsfHoraInicioTardeMMSab.setMinimum(0);

        jlbl29.setText("MM");

        jsfHoraFinTardeHHSab.setMaximum(23);
        jsfHoraFinTardeHHSab.setMinimum(0);

        jlbl28.setText("HH");

        jsfHoraFinTardeMMSab.setMaximum(59);
        jsfHoraFinTardeMMSab.setMinimum(0);

        jsfHoraInicioTardeHHSab.setMaximum(23);
        jsfHoraInicioTardeHHSab.setMinimum(0);

        jlbl27.setText("Hora Inicio");

        jlbl31.setText("HH");

        jlbl30.setText("Hora Fin");

        jlblManianaSab.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblManianaSab.setText("MAÑANA");

        jlblTardeSab.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblTardeSab.setText("TARDE");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setText("Horario Corrido");

        jchkHorarioCorridoSab.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jchkHorarioCorridoSabItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlblManianaSab)
                    .addComponent(jLabel8)
                    .addComponent(jlblTardeSab))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jchkHorarioCorridoSab)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel6Layout.createSequentialGroup()
                            .addComponent(jlbl27)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraInicioTardeHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl28)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraInicioTardeMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl29)
                            .addGap(18, 18, 18)
                            .addComponent(jlbl30)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraFinTardeHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl31)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraFinTardeMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl32))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                            .addComponent(jlbl19)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraInicioManianaHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl20)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraInicioManianaMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl21)
                            .addGap(18, 18, 18)
                            .addComponent(jlbl22)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraFinManianaHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl23)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jsfHoraFinManianaMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl24))))
                .addGap(117, 117, 117))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel8)
                    .addComponent(jchkHorarioCorridoSab))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jlbl19)
                    .addComponent(jsfHoraInicioManianaHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jsfHoraInicioManianaMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl20)
                    .addComponent(jlbl21)
                    .addComponent(jlbl22)
                    .addComponent(jsfHoraFinManianaHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl23)
                    .addComponent(jsfHoraFinManianaMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl24)
                    .addComponent(jlblManianaSab))
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jlblTardeSab))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(jlbl27)
                            .addComponent(jsfHoraInicioTardeHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jlbl28)
                            .addComponent(jsfHoraInicioTardeMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jlbl29)
                            .addComponent(jlbl30)
                            .addComponent(jsfHoraFinTardeHHSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jlbl31)
                            .addComponent(jsfHoraFinTardeMMSab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jlbl32))))
                .addContainerGap(16, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(50, 50, 50)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jtxtDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtxtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(50, 50, 50)
                        .addComponent(jchkEstado))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 517, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel2)
                    .addComponent(jtxtDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jchkEstado))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Mantenimiento", new javax.swing.ImageIcon(getClass().getResource("/com/jsysacc/asistencia/view/resources/icons/px_16_16/btn_mant_16.png")), jPanel1); // NOI18N

        jbtnAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jsysacc/asistencia/view/resources/icons/px_24_24/btn_ok_24.png"))); // NOI18N
        jbtnAceptar.setText("Aceptar");
        jbtnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 542, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jbtnAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtnAceptar)
                    .addComponent(jbtnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbtnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCancelarActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jbtnCancelarActionPerformed

    private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAceptarActionPerformed
        if (!hayErroresInput()) {

            getEntity();

            try {
                if (esNuevo) {
                    if (logic.insert(entityHorario)) {
                        JOptionPane.showMessageDialog(this, rbMensajes.getString("MSG_INS_OK"), rbMensajes.getString("MSG_MEN_PRI"), 1);
                        this.dispose();
                    } else {
                        JOptionPane.showMessageDialog(this, rbMensajes.getString("MSG_INS_ERROR"), rbMensajes.getString("MSG_MEN_PRI"), 0);
                    }
                } else {
                    if (logic.update(entityHorario)) {
                        JOptionPane.showMessageDialog(this, "<html>" + rbMensajes.getString("MSG_UPD_OK") + " <b>" + codHorario + "</b></html>", rbMensajes.getString("MSG_MEN_PRI"), 1);
                        this.dispose();
                    } else {
                        JOptionPane.showMessageDialog(this, rbMensajes.getString("MSG_UPD_ERROR"), rbMensajes.getString("MSG_MEN_PRI"), 0);
                    }
                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, ex.getMessage(), rbMensajes.getString("MSG_MEN_PRI"), 0);
            }

        }
    }//GEN-LAST:event_jbtnAceptarActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
        initMaster();
    }//GEN-LAST:event_formWindowOpened

    private void jchkHorarioCorridoLVItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jchkHorarioCorridoLVItemStateChanged
        // TODO add your handling code here:
        checkHorarioCorridoLV(this.jchkHorarioCorridoLV.isSelected());
    }//GEN-LAST:event_jchkHorarioCorridoLVItemStateChanged

    private void jchkHorarioCorridoSabItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jchkHorarioCorridoSabItemStateChanged
        // TODO add your handling code here:
        checkHorarioCorridoSab(this.jchkHorarioCorridoSab.isSelected());
    }//GEN-LAST:event_jchkHorarioCorridoSabItemStateChanged

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FormDialogMantHorario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FormDialogMantHorario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FormDialogMantHorario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FormDialogMantHorario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                FormDialogMantHorario dialog = new FormDialogMantHorario(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtnAceptar;
    private javax.swing.JButton jbtnCancelar;
    private javax.swing.JCheckBox jchkEstado;
    private javax.swing.JCheckBox jchkHorarioCorridoLV;
    private javax.swing.JCheckBox jchkHorarioCorridoSab;
    private javax.swing.JLabel jlbl03;
    private javax.swing.JLabel jlbl04;
    private javax.swing.JLabel jlbl05;
    private javax.swing.JLabel jlbl06;
    private javax.swing.JLabel jlbl07;
    private javax.swing.JLabel jlbl08;
    private javax.swing.JLabel jlbl11;
    private javax.swing.JLabel jlbl12;
    private javax.swing.JLabel jlbl13;
    private javax.swing.JLabel jlbl14;
    private javax.swing.JLabel jlbl15;
    private javax.swing.JLabel jlbl16;
    private javax.swing.JLabel jlbl19;
    private javax.swing.JLabel jlbl20;
    private javax.swing.JLabel jlbl21;
    private javax.swing.JLabel jlbl22;
    private javax.swing.JLabel jlbl23;
    private javax.swing.JLabel jlbl24;
    private javax.swing.JLabel jlbl27;
    private javax.swing.JLabel jlbl28;
    private javax.swing.JLabel jlbl29;
    private javax.swing.JLabel jlbl30;
    private javax.swing.JLabel jlbl31;
    private javax.swing.JLabel jlbl32;
    private javax.swing.JLabel jlblManianaLV;
    private javax.swing.JLabel jlblManianaSab;
    private javax.swing.JLabel jlblTardeLV;
    private javax.swing.JLabel jlblTardeSab;
    private com.toedter.components.JSpinField jsfHoraFinManianaHHLV;
    private com.toedter.components.JSpinField jsfHoraFinManianaHHSab;
    private com.toedter.components.JSpinField jsfHoraFinManianaMMLV;
    private com.toedter.components.JSpinField jsfHoraFinManianaMMSab;
    private com.toedter.components.JSpinField jsfHoraFinTardeHHLV;
    private com.toedter.components.JSpinField jsfHoraFinTardeHHSab;
    private com.toedter.components.JSpinField jsfHoraFinTardeMMLV;
    private com.toedter.components.JSpinField jsfHoraFinTardeMMSab;
    private com.toedter.components.JSpinField jsfHoraInicioManianaHHLV;
    private com.toedter.components.JSpinField jsfHoraInicioManianaHHSab;
    private com.toedter.components.JSpinField jsfHoraInicioManianaMMLV;
    private com.toedter.components.JSpinField jsfHoraInicioManianaMMSab;
    private com.toedter.components.JSpinField jsfHoraInicioTardeHHLV;
    private com.toedter.components.JSpinField jsfHoraInicioTardeHHSab;
    private com.toedter.components.JSpinField jsfHoraInicioTardeMMLV;
    private com.toedter.components.JSpinField jsfHoraInicioTardeMMSab;
    private javax.swing.JTextField jtxtCodigo;
    private javax.swing.JTextField jtxtDescripcion;
    // End of variables declaration//GEN-END:variables
    public boolean isEsNuevo() {
        return esNuevo;
    }

    public void setEsNuevo(boolean esNuevo) {
        this.esNuevo = esNuevo;
    }

    public String getCodHorario() {
        return codHorario;
    }

    public void setCodHorario(String codHorario) {
        this.codHorario = codHorario;
    }

    @Override
    public boolean hayErroresInput() {
//        this.jsfHoraFinManianaHHLV.get
//        if (JUB._vacio(this.jtxtDescripcion.getText())) {
//            JOptionPane.showMessageDialog(this, "CAMPO DESCRIPCIÓN NO PUEDE ESTAR VACIO", rbMensajes.getString("MSG_MEN_PRI"), 1);
//            JUB.selectionJTextField(this.jtxtDescripcion);
//            return true;
//        }
//
//        if (JUB.toUpperBlank(this.jtxtDescripcion.getText()).length() > 50) {
//            JOptionPane.showMessageDialog(this, "CAMPO DESCRIPCIÓN NO PUEDE TENER MAS DE 50 CARACTERES", rbMensajes.getString("MSG_MEN_PRI"), 1);
//            JUB.selectionJTextField(this.jtxtDescripcion);
//            return true;
//        }
//
//        if (JUB._vacio(this.jdtDiaFeriado.getDate())) {
//            JOptionPane.showMessageDialog(this, "CAMPO FECHA NO PUEDE ESTAR VACIO", rbMensajes.getString("MSG_MEN_PRI"), 1);
//            jdtDiaFeriado.requestFocus();
//            return true;
//        }
        return false;
    }

    @Override
    public void getEntity() {
        entityHorario = new Horario();
        entityHorario.setCod_hor(JUB.toUpperBlank(this.jtxtCodigo.getText()));
        entityHorario.setDescrip(JUB.toUpperBlank(this.jtxtDescripcion.getText()));
        entityHorario.setEstado(this.jchkEstado.isSelected() ? "A" : "I");
        ///LV
        entityHorario.setHor_cor_lv(this.jchkHorarioCorridoLV.isSelected() ? "S" : "");
        entityHorario.setTol_man_lv("");
        String hor_ini_man_lv = JUB.PADL(JUB.toString(this.jsfHoraInicioManianaHHLV.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraInicioManianaMMLV.getValue()), 2, '0');
        entityHorario.setHor_ini_man_lv(hor_ini_man_lv);
        String hor_fin_man_lv = JUB.PADL(JUB.toString(this.jsfHoraFinManianaHHLV.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraFinManianaMMLV.getValue()), 2, '0');
        entityHorario.setHor_fin_man_lv(hor_fin_man_lv);
        //tarde
        entityHorario.setTol_tar_lv("");
        String hor_ini_tar_lv = JUB.PADL(JUB.toString(this.jsfHoraInicioTardeHHLV.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraInicioTardeMMLV.getValue()), 2, '0');
        entityHorario.setHor_ini_tar_lv(hor_ini_tar_lv);
        String hor_fin_tar_lv = JUB.PADL(JUB.toString(this.jsfHoraFinTardeHHLV.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraFinTardeMMLV.getValue()), 2, '0');
        entityHorario.setHor_fin_tar_lv(hor_fin_tar_lv);

        //Sabado
        entityHorario.setHor_cor_sab(this.jchkHorarioCorridoSab.isSelected() ? "S" : "");
        entityHorario.setTol_man_sab("");
        String hor_ini_man_sab = JUB.PADL(JUB.toString(this.jsfHoraInicioManianaHHSab.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraInicioManianaMMSab.getValue()), 2, '0');
        entityHorario.setHor_ini_man_sab(hor_ini_man_sab);
        String hor_fin_man_sab = JUB.PADL(JUB.toString(this.jsfHoraFinManianaHHSab.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraFinManianaMMSab.getValue()), 2, '0');
        entityHorario.setHor_fin_man_sab(hor_fin_man_sab);
        //tarde
        entityHorario.setTol_tar_sab("");
        String hor_ini_tar_sab = JUB.PADL(JUB.toString(this.jsfHoraInicioTardeHHSab.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraInicioTardeMMSab.getValue()), 2, '0');
        entityHorario.setHor_ini_tar_sab(hor_ini_tar_sab);
        String hor_fin_tar_sab = JUB.PADL(JUB.toString(this.jsfHoraFinTardeHHSab.getValue()), 2, '0')
                + ":" + JUB.PADL(JUB.toString(this.jsfHoraFinTardeMMSab.getValue()), 2, '0');
        entityHorario.setHor_fin_tar_sab(hor_fin_tar_sab);

    }

    @Override
    public void setEntity(Object entity) {
        Horario oHorario = (Horario) entity;
        this.jtxtCodigo.setText(oHorario.getCod_hor());
        this.jtxtDescripcion.setText(oHorario.getDescrip());
        //LV
        this.jchkHorarioCorridoLV.setSelected(JUB._equiv(oHorario.getHor_cor_lv(), "S"));
        //Mañana
        String[] hor_ini_man_lv = oHorario.getHor_ini_man_lv().split(":");
        this.jsfHoraInicioManianaHHLV.setValue(JUB.toInt(hor_ini_man_lv[0]));
        this.jsfHoraInicioManianaMMLV.setValue(JUB.toInt(hor_ini_man_lv[1]));
        String[] hor_fin_man_lv = oHorario.getHor_fin_man_lv().split(":");
        this.jsfHoraFinManianaHHLV.setValue(JUB.toInt(hor_fin_man_lv[0]));
        this.jsfHoraFinManianaMMLV.setValue(JUB.toInt(hor_fin_man_lv[1]));
        //Tarde
        String[] hor_ini_tar_lv = oHorario.getHor_ini_tar_lv().split(":");
        this.jsfHoraInicioTardeHHLV.setValue(JUB.toInt(hor_ini_tar_lv[0]));
        this.jsfHoraInicioTardeMMLV.setValue(JUB.toInt(hor_ini_tar_lv[1]));
        String[] hor_fin_tar_lv = oHorario.getHor_fin_tar_lv().split(":");
        this.jsfHoraFinTardeHHLV.setValue(JUB.toInt(hor_fin_tar_lv[0]));
        this.jsfHoraFinTardeMMLV.setValue(JUB.toInt(hor_fin_tar_lv[1]));

        //Sabado
        this.jchkHorarioCorridoSab.setSelected(JUB._equiv(oHorario.getHor_cor_sab(), "S"));
        //Mañana

        String[] hor_ini_man_sab = oHorario.getHor_ini_man_sab().split(":");
        this.jsfHoraInicioManianaHHSab.setValue(JUB.toInt(hor_ini_man_sab[0]));
        this.jsfHoraInicioManianaMMSab.setValue(JUB.toInt(hor_ini_man_sab[1]));
        String[] hor_fin_man_sab = oHorario.getHor_fin_man_sab().split(":");
        this.jsfHoraFinManianaHHSab.setValue(JUB.toInt(hor_fin_man_sab[0]));
        this.jsfHoraFinManianaMMSab.setValue(JUB.toInt(hor_fin_man_sab[1]));
        //Tarde
        String[] hor_ini_tar_sab = oHorario.getHor_ini_tar_sab().split(":");
        this.jsfHoraInicioTardeHHSab.setValue(JUB.toInt(hor_ini_tar_sab[0]));
        this.jsfHoraInicioTardeMMSab.setValue(JUB.toInt(hor_ini_tar_sab[1]));
        String[] hor_fin_tar_sab = oHorario.getHor_fin_tar_sab().split(":");
        this.jsfHoraFinTardeHHSab.setValue(JUB.toInt(hor_fin_tar_sab[0]));
        this.jsfHoraFinTardeMMSab.setValue(JUB.toInt(hor_fin_tar_sab[1]));

        this.jchkEstado.setSelected(JUB._equiv(oHorario.getEstado(), "A"));
    }

    @Override
    public void initMaster() {
        this.jtxtCodigo.setDocument(new JTextFieldToUpperCase());
        this.jtxtDescripcion.setDocument(new JTextFieldToUpperCase());
        llenarData();
    }

}
